interface PublicCard {
	isShowCardMark: boolean
	src: string
}

interface GrayCardImage {
	isShowCardMark: boolean
	isShowCardGray: boolean
	src: string
}

interface PublicCardImage {
	isShowCardGray: boolean
	src: string
}

function formatScoreNumber(val: any): string {
	const num: number = Number(val) || 0
	const kNum: number = 1000 // K unit
	const mNum: number = 1000000 // M unit
	let newVal: string | number = val
	if (num >= mNum) {
		newVal = num / mNum + "M"
	} else if (num >= kNum) {
		newVal = num / kNum + "K"
	}
	return newVal.toString()
}

function getTopInfoPublicCardsImg(publicCardsNum: any[], markCardArr: any[] = []): PublicCard[] {
	if (!publicCardsNum) return []
	const markCardsArr: number[] =
		markCardArr?.length > 0 ? markCardArr.filter(item => item.manipulateMark === true).map(item => parseInt(item.cardNum)) : []

	return publicCardsNum.map(publicCard => ({
		isShowCardMark: markCardsArr.indexOf(parseInt(publicCard)) > -1,
		src: getCardsImg(publicCard)
	}))
}

function getGrayCardImg(
	showGrayCardsArr: any[],
	publicCardsArr: any[],
	handCardsArr: any[],
	markCardArr: any[] = []
): { publicCardsImg: PublicCardImage[]; handCardsImg: GrayCardImage[] } {
	const markCardsArr: number[] =
		markCardArr?.length > 0 ? markCardArr.filter(item => item.manipulateMark === true).map(item => parseInt(item.cardNum)) : []

	const grayCardsArr: number[] = showGrayCardsArr
		.filter(item => Object.values(item)[0] === true)
		.map(item => parseInt(Object.keys(item)[0]))

	const publicCardsImg: PublicCardImage[] = publicCardsArr.map(publicCard => ({
		isShowCardGray: grayCardsArr.indexOf(parseInt(publicCard)) > -1,
		src: getCardsImg(publicCard)
	}))

	const handCardsImg: GrayCardImage[] = handCardsArr.map(handCard => ({
		isShowCardMark: markCardsArr.indexOf(parseInt(handCard)) > -1,
		isShowCardGray: grayCardsArr.indexOf(parseInt(handCard)) > -1,
		src: getCardsImg(handCard)
	}))

	return { publicCardsImg, handCardsImg }
}

function getImageUrl(imgName: string): string {
	if (!imgName) {
		imgName = "icon-fail.png"
	}
	return "/images/game/" + imgName
}

export function getGameTypeName(gameTypeId: number): string {
	let gameTypeName: string | undefined = gameTypeMap.get(gameTypeId)
	if (!gameTypeName) {
		gameTypeName = "Game"
	}
	return gameTypeName
}

function getCardsImg(cardsNum: number): string {
	const imgName: string | undefined = cardsMap.get(parseInt(cardsNum as unknown as string)) as string
	return imgName ? getImageUrl(imgName) : ""
}

function getOtherImg(imgCode: string): string {
	const imgName: string | undefined = otherImgMap.get(imgCode)
	return imgName ? getImageUrl(imgName) : ""
}

const otherImgMap: Map<string, string> = new Map([
	["eye", "invalidName.png"],
	["insure", "baoxian.png"],
	["abnormal", "abnormal.png"],
	["squid_red", "gameReviewOp_YR.png"] // 鱿鱼红色图标
])

const gameTypeMap: Map<number, string> = new Map([
	[2001, "德州扑克"],
	[2002, "短牌"],
	[2003, "AOF德州"],
	[2004, "AOF短牌"]
])

const cardsMap: Map<number, string> = new Map([
	[0, "diamond_a_card.png"], // 方片1
	[1, "club_a_card.png"], // 梅花1
	[2, "heart_a_card.png"], // 红桃1
	[3, "spade_a_card.png"], // 黑桃1

	[4, "diamond_2_card.png"], // 方片2
	[5, "club_2_card.png"], // 梅花2
	[6, "heart_2_card.png"], // 红桃2
	[7, "spade_2_card.png"], // 黑桃2

	[8, "diamond_3_card.png"], // 方片3
	[9, "club_3_card.png"], // 梅花3
	[10, "heart_3_card.png"], // 红桃3
	[11, "spade_3_card.png"], // 黑桃3

	[12, "diamond_4_card.png"], // 方片4
	[13, "club_4_card.png"], // 梅花4
	[14, "heart_4_card.png"], // 红桃4
	[15, "spade_4_card.png"], // 黑桃4

	[16, "diamond_5_card.png"], // 方片5
	[17, "club_5_card.png"], // 梅花5
	[18, "heart_5_card.png"], // 红桃5
	[19, "spade_5_card.png"], // 黑桃5

	[20, "diamond_6_card.png"], // 方片6
	[21, "club_6_card.png"], // 梅花6
	[22, "heart_6_card.png"], // 红桃6
	[23, "spade_6_card.png"], // 黑桃6

	[24, "diamond_7_card.png"], // 方片7
	[25, "club_7_card.png"], // 梅花7
	[26, "heart_7_card.png"], // 红桃7
	[27, "spade_7_card.png"], // 黑桃7

	[28, "diamond_8_card.png"], // 方片8
	[29, "club_8_card.png"], // 梅花8
	[30, "heart_8_card.png"], // 红桃8
	[31, "spade_8_card.png"], // 黑桃8

	[32, "diamond_9_card.png"], // 方片9
	[33, "club_9_card.png"], // 梅花9
	[34, "heart_9_card.png"], // 红桃9
	[35, "spade_9_card.png"], // 黑桃9

	[36, "diamond_10_card.png"], // 方片10
	[37, "club_10_card.png"], // 梅花10
	[38, "heart_10_card.png"], // 红桃10
	[39, "spade_10_card.png"], // 黑桃10

	[40, "diamond_j_card.png"], // 方片J
	[41, "club_j_card.png"], // 梅花J
	[42, "heart_j_card.png"], // 红桃J
	[43, "spade_j_card.png"], // 黑桃J

	[44, "diamond_q_card.png"], // 方片Q
	[45, "club_q_card.png"], // 梅花Q
	[46, "heart_q_card.png"], // 红桃Q
	[47, "spade_q_card.png"], // 黑桃Q

	[48, "diamond_k_card.png"], // 方片K
	[49, "club_k_card.png"], // 梅花K
	[50, "heart_k_card.png"], // 红桃K
	[51, "spade_k_card.png"] // 黑桃K
])

const betOpColorMap: Map<string, string> = new Map([
	["2B", "#d64f4f"],
	["3B", "#d64f4f"],
	["4B", "#d64f4f"],
	["5B", "#d64f4f"],
	["6B", "#d64f4f"],
	["7B", "#d64f4f"],
	["8B", "#d64f4f"],
	["9B", "#d64f4f"],
	["10B", "#d64f4f"],
	["A", "#d64f4f"],
	["B", "#d64f4f"],
	["BB", "#3eb76a"],
	["C", "#3eb76a"],
	["F", "#7e7e7e"],
	["R", "#d64f4f"],
	["RB", "#ff6e00"],
	["SB", "#3eb76a"],
	["X", "#3eb76a"],
	["TB", "#ffcd01"],
	["PF", "#ffcd01"],
	["BH", "#ffcd01"],
	["Ins", "#ffcd01"],
	["ANTE", "#3eb76a"],
	["AN", "#3eb76a"],
	["S", "#d64f4f"]
])

export const getGameReplayDetail = async (that: {
	$api: { showGameReviewCardListBend: (arg0: any) => Promise<any>; getGameReviewDeatailListBend: (arg0: any) => Promise<any> }
	replayQuery: any
	handStatus: number
}) => {
	try {
		//已结束状态下必须两个接口都返回数据,否则不返回
		return await Promise.all([
			that.$api.showGameReviewCardListBend(that.replayQuery).then(res => {
				if (that.handStatus === 1 && !res?.[1]?.totalRecord) {
					return Promise.reject({ record: "数据生成中" })
				}
				return Promise.resolve(formatReplayDetailRes(res?.[1]))
			}),
			that.$api.getGameReviewDeatailListBend(that.replayQuery).then(detailRes => {
				if (that.handStatus === 1 && !detailRes?.[1]?.totalRecord) {
					return Promise.reject({ record: "数据生成中" })
				}
				return Promise.resolve(formatGameReplayListRes(detailRes?.[1].record))
			})
		]).then(allRes => {
			return Promise.resolve({ replayDetail: allRes[0], replayList: allRes[1] })
		})
	} catch (e) {
		// js代码出现异常或者后端接口出现异常
		return Promise.reject({
			message: "未获取数据",
			error: e
		})
	}
}

const stepNameMap = new Map([
	["Detail", "牌谱"],
	["PRE", "翻前"],
	["FLOP", "翻牌圈"],
	["TURN", "转牌圈"],
	["RIVER", "河牌圈"],
	["SHOWDOWN", "摊牌"]
])

// 保险code映射名称
const insureNameMap = new Map([
	["TB", "投保"],
	["PF", "赔付"],
	["BH", "背回"]
])

export function formatReplayDetailRes(replayDetailRes: {
	record: any[]
	summary: {
		gameType: any
		id: any
		clubName: any
		maxSeatCount: any
		joinCount: any
		sbBlindScore: any
		bbBlindScore: any
		anteScore: number
		straddleAmount: number
		handStartDateStr: any
		potAmount: any
		insuredPool: any
	}
}) {
	if (!replayDetailRes?.record?.length || !replayDetailRes?.summary) {
		return {
			gameType: "",
			info: {},
			topInfo: {},
			bottomList: [],
			insurePoolDetail: {}
		}
	}
	// 牌局回放标题信息
	const gameType = replayDetailRes.summary.gameType
	const info = {
		gameType: gameType,
		handId: replayDetailRes.summary.id, // 手牌ID
		clubName: replayDetailRes.summary.clubName, // 俱乐部名称
		gameTypeName: getGameTypeName(gameType), // 游戏名称
		maxSeatCount: replayDetailRes.summary.maxSeatCount, // 最大人数
		joinCount: replayDetailRes.summary.joinCount, // 加入人数
		sbBlindScore: formatScoreNumber(replayDetailRes.summary.sbBlindScore), // 小盲注
		bbBlindScore: formatScoreNumber(replayDetailRes.summary.bbBlindScore), // 大盲注
		anteScore: formatScoreNumber(replayDetailRes.summary.anteScore), // 前注(大于0显示前注)
		straddleAmount: formatScoreNumber(replayDetailRes.summary.straddleAmount), // 强抓金额(大于0显示)
		isShowAnteScore: replayDetailRes.summary.anteScore > 0, // 是否显示前注
		isShowStraddleAmount: replayDetailRes.summary.straddleAmount > 0, // 是否显示强抓金额
		handStartDateStr: replayDetailRes.summary?.handStartDateStr || "" // 手牌开始时间
	}
	// 牌谱列表顶部信息
	const topInfo: {
		stepName: string | undefined
		stepShowIndex: string
		stepItemMiddle: boolean
		joinCount: any
		potAmount: any
		publicCardsImg: PublicCard[]
	} = {
		stepName: stepNameMap.get("Detail"),
		stepShowIndex: "Detail",
		stepItemMiddle: false,
		joinCount: replayDetailRes.summary.joinCount,
		potAmount: replayDetailRes.summary.potAmount,
		// publicCardsImg: getTopInfoPublicCardsImg(replayDetailRes.summary.publicCards),
		publicCardsImg: []
	}
	// 保险池
	const insurePoolDetail = {
		isInsured: 0,
		title: "保险池:",
		src: getOtherImg("insure"),
		insuredPool: replayDetailRes.summary.insuredPool || 0
	}
	// 牌谱列表信息
	const bottomList: {
		isShowCardEye: boolean // 是否展示扑克眼睛图片
		fontGrayStyle: string // 列表项文字置灰
		nickName: any // 昵称
		seatCodeName: any // 玩家位置
		resultInfo: any // 牌型
		publicCardsImg: PublicCardImage[] // 公共牌信息
		handCardsImg: GrayCardImage[] // 手牌信息
		netAmount: any // 打牌盈亏,盈亏筹码
		isInsured: any // 是否投保:0否,1是
		insuredNetAmount: any // 保险池金额
		totalNetAmount: any // 总盈亏
		hidden: boolean
	}[] = []
	replayDetailRes.record.forEach(item => {
		if (topInfo.publicCardsImg.length === 0 && item.publicCards?.length > 0) {
			topInfo.publicCardsImg = getTopInfoPublicCardsImg(item.publicCards, item.publicCardExtList)
		}

		const bottomRow: {
			isShowCardEye: boolean // 是否展示扑克眼睛图片
			fontGrayStyle: string // 列表项文字置灰
			nickName: any // 昵称
			seatCodeName: any // 玩家位置
			resultInfo: any // 牌型
			publicCardsImg: PublicCardImage[] // 公共牌信息
			handCardsImg: GrayCardImage[] // 手牌信息
			netAmount: any // 打牌盈亏,盈亏筹码
			isInsured: any // 是否投保:0否,1是
			insuredNetAmount: any // 保险池金额
			totalNetAmount: any // 总盈亏
			hidden: boolean
		} = {
			isShowCardEye: item?.showFlag === true, // 是否展示扑克眼睛图片
			fontGrayStyle: item.betStatus === 6 ? "fontGrayStyle" : "", // 列表项文字置灰
			nickName: (item.userName || "") + ` (${item.nickName || "-"})`, // 昵称
			// seatPosImg: item.seatCode ? getSeatPosImg(item.seatCode, gameType) : getImageUrl(undefined), // 玩家位置
			seatCodeName: item.seatCodeName, // 玩家位置
			resultInfo: item.betStatus === 6 ? "Fold" : item.resultInfo, // 牌型
			publicCardsImg: [], // 公共牌信息
			handCardsImg: [], // 手牌信息
			netAmount: item?.netAmount || 0, // 打牌盈亏,盈亏筹码
			isInsured: item?.isInsured, // 是否投保:0否,1是
			insuredNetAmount: item?.insuredNetAmount || 0, // 保险池金额
			totalNetAmount: parseInt(item?.totalNetAmount) > 0 ? "+" + item?.totalNetAmount : item?.totalNetAmount || 0, // 总盈亏,
			hidden: false
		}

		// 列表中只要有一项购买了保险,则底部需要展示保险
		if (item?.isInsured === 1) {
			insurePoolDetail.isInsured = 1
		}
		// 获取置灰的图片
		const grayCardsImgObj = getGrayCardImg(item.showCards, item.publicCards, item.handCards, item.handCardExtList)
		bottomRow.publicCardsImg = grayCardsImgObj.publicCardsImg
		bottomRow.handCardsImg = grayCardsImgObj.handCardsImg
		if (!bottomRow.hidden) {
			bottomList.push(bottomRow)
		}
	})
	const summary = {
		gameType: gameType,
		info: info,
		topInfo: topInfo,
		bottomList: bottomList,
		insurePoolDetail: insurePoolDetail
	}
	return summary
}

export function formatGameReplayListRes(gameReplayListRes: any[]) {
	if (!gameReplayListRes?.length) {
		return []
	}
	const replayStepArr: {
		topInfo: {
			stepName: string | undefined
			stepShowIndex: string | undefined
			stepItemMiddle: boolean
			isShowPublicCards: boolean
			isShowJoinCount: boolean
			joinCount: any
			potAmount: any
			publicCardsImg: PublicCard[]
		}
		bottomList: any[]
		insurePoolDetail?: { isInsured: number; title: string; src: string; insuredPool: any }
	}[] = []
	const stepItemMiddleArr = ["翻前", "翻牌圈", "转牌圈", "河牌圈"]

	gameReplayListRes.forEach(
		(items: { roundCode: string; joinCount: any; potAmount: any; insuredPool: any; gameRecordRoundDeatailList: any[] }) => {
			// 牌局步骤标识: [PRE,FLOP,TURN,RIVER,SHOWDOWN]
			const isPre = items.roundCode === "PRE"
			const isFlop = items.roundCode === "FLOP"
			const isTurn = items.roundCode === "TURN"
			const isRiver = items.roundCode === "RIVER"
			const isShowDown = items.roundCode === "SHOWDOWN"
			const stepName1 = stepNameMap.get(items.roundCode)
			// const gameType = items.gameType
			// 步骤顶部信息
			const topInfo: {
				stepName: string | undefined
				stepShowIndex: string | undefined
				stepItemMiddle: boolean
				isShowPublicCards: boolean
				isShowJoinCount: boolean
				joinCount: number
				potAmount: number
				publicCardsImg: PublicCard[]
			} = {
				stepName: stepName1,
				stepShowIndex: stepName1,
				stepItemMiddle: stepName1 ? stepItemMiddleArr.indexOf(stepName1) > -1 : false,
				isShowPublicCards: true,
				isShowJoinCount: true,
				joinCount: items.joinCount,
				potAmount: items.potAmount,
				publicCardsImg: []
			}
			// pre步骤不展示公共牌和加入人数
			if (isPre) {
				// topInfo.isShowPublicCards = false
				topInfo.isShowJoinCount = false
			}
			// showdown步骤不展示加入人数
			if (isShowDown) {
				topInfo.isShowJoinCount = false
			}
			// 保险池
			const insurePoolDetail = {
				isInsured: 0,
				title: "保险池:",
				src: getOtherImg("insure"),
				insuredPool: items.insuredPool || 0
			}
			// 步骤底部列表
			const bottomList: {
				isShowCardEye: boolean // 是否展示扑克眼睛图片
				fontGrayStyle: string // 列表项文字置灰
				nickName: any // 昵称
				isPlusBetAction: any // 超过10次标识
				betAction: any // 玩家下注指令
				betAmount: any // 玩家下注金额
				betAmountText: string // 玩家下注金额前缀,标识保险类型
				seatCodeName: any // 玩家位置
				publicCardsImg: PublicCardImage[] // 公共牌
				handCardsImg: GrayCardImage[] // 手牌
				resultInfo: string
				rightValue: string
				isFTR: boolean // 是否是Flop,Turn,River
				netAmount: any // 打牌盈亏
				isInsured: any // 是否投保:0否,1是
				insuredNetAmount: any // 保险池金额
				totalNetAmount: any // 总盈亏
				isSelf: any // 是否是自己
				insurePool: any // 投保池金额
				insureType: string // 投保池类型
				hidden: any // 是否隐藏, 一般此项用于各玩家均能支付Ante的操作项
				betActionColor: string
				afterChip: string
				leijiPotAmount: number
				isShowFold: boolean
				showFoldTitle: string
			}[] = []
			// 统计弃牌人数
			// let consecutiveFoldCount = 0
			// 数组长度判断是否为索引最后一条
			// const listLength = items?.gameRecordRoundDeatailList?.length
			const winSquidRoundList: {
				isWinSquidRecord: boolean
				seatCodeName: any // 玩家位置
				nickName: any // 昵称
				betOpImg: string
				betAmountText: string // 鱿鱼数量
			}[] = [] // 获取鱿鱼的用户数

			items.gameRecordRoundDeatailList.forEach(
				(item: {
					publicCards: string
					handCards: string
					isPlusBetAction: boolean
					betAction: string
					raiseCount: number
					showFlag: boolean
					nickName: any
					betAmount: any
					seatCodeName: any
					netAmount: any
					isInsured: number
					insuredNetAmount: any
					totalNetAmount: string
					isSelf: any
					potAmount: any
					potNo: string
					hidden: any
					afterChip: any
					leijiPotAmount: any
					resultInfo: string
					showCards: any[]
					winSquid: number
					squidNumber: number
				}) => {
					// 判断是否为连续弃牌折叠用户
					// const isFold = item?.consecutiveFold === true
					// if (isFold) {
					// 	consecutiveFoldCount++
					// }
					item.publicCards = item?.publicCards?.replace(/[[\]]/g, "")
					item.handCards = item?.handCards?.replace(/[[\]]/g, "")
					if (topInfo.publicCardsImg.length === 0 && item.publicCards) {
						topInfo.publicCardsImg = getTopInfoPublicCardsImg(isPre ? item.handCards.split(",") : item.publicCards.split(","))
					}
					// 如果是R并且raiseCount>10，直接展示
					item.isPlusBetAction = false
					if (item.betAction === "R" && item.raiseCount > 10) {
						item.isPlusBetAction = true
					}
					// 如果是R并且raiseCount>2，需要在前面加上raiseCount+B
					if (item.betAction === "R" && item.raiseCount > 2) {
						item.betAction = item.raiseCount + "B"
					}
					// betAction是下注指令, F为弃牌操作，需要特殊展示
					const bottomRow: {
						isShowCardEye: boolean // 是否展示扑克眼睛图片
						fontGrayStyle: string // 列表项文字置灰
						nickName: string // 昵称
						isPlusBetAction: boolean // 超过10次标识
						betAction: any // 玩家下注指令
						betAmount: number // 玩家下注金额
						betAmountText: string // 玩家下注金额前缀,标识保险类型
						seatCodeName: string // 玩家位置
						publicCardsImg: PublicCardImage[] // 公共牌
						handCardsImg: GrayCardImage[] // 手牌
						resultInfo: string
						rightValue: string
						isFTR: boolean // 是否是Flop,Turn,River
						netAmount: boolean // 打牌盈亏
						isInsured: boolean // 是否投保:0否,1是
						insuredNetAmount: number // 保险池金额
						totalNetAmount: number | string // 总盈亏
						isSelf: boolean // 是否是自己
						insurePool: number // 投保池金额
						insureType: string // 投保池类型
						hidden: boolean // 是否隐藏, 一般此项用于各玩家均能支付Ante的操作项,
						betActionColor: string
						afterChip: string
						leijiPotAmount: number
						isShowFold: boolean
						showFoldTitle: string
						isWinSquidRecord: boolean
					} = {
						isShowCardEye: item?.showFlag === true, // 是否展示扑克眼睛图片
						fontGrayStyle: item.betAction === "F" ? "fontGrayStyle" : "", // 列表项文字置灰
						nickName: item.nickName, // 昵称
						isPlusBetAction: item.isPlusBetAction, // 超过10次标识
						betAction: item.betAction, // 玩家下注指令
						betAmount: item.betAmount, // 玩家下注金额
						betAmountText: insureNameMap.get(item.betAction) || "", // 玩家下注金额前缀,标识保险类型
						seatCodeName: item.seatCodeName, // 玩家位置
						publicCardsImg: [], // 公共牌
						handCardsImg: [], // 手牌
						resultInfo: "-",
						rightValue: "-",
						isFTR: false, // 是否是Flop,Turn,River
						netAmount: item?.netAmount || 0, // 打牌盈亏
						isInsured: !!item?.isInsured, // 是否投保:0否,1是
						insuredNetAmount: item?.insuredNetAmount || 0, // 保险池金额
						totalNetAmount: parseInt(item?.totalNetAmount) > 0 ? "+" + item?.totalNetAmount : item?.totalNetAmount || 0, // 总盈亏
						isSelf: item?.isSelf, // 是否是自己
						insurePool: item.potAmount, // 投保池金额
						insureType: item.potNo === "0" ? "主池" : "边池" + item.potNo, // 投保池类型
						hidden: item.hidden, // 是否隐藏, 一般此项用于各玩家均能支付Ante的操作项,
						betActionColor: "",
						afterChip: "",
						leijiPotAmount: 0,
						isShowFold: false,
						showFoldTitle: "",
						isWinSquidRecord: false
					}
					// ANTE转换
					if (item.betAction === "ANTE") {
						bottomRow.betAction = "AN"
					}
					// 投保转换
					if (insureNameMap.get(item.betAction)) {
						bottomRow.betAction = "Ins"
					}
					// 玩家行为对应背景色
					bottomRow.betActionColor = betOpColorMap.get(bottomRow.betAction) || "#d64f4f"

					// 列表中只要有一项购买了保险,则底部需要展示保险
					if (item?.isInsured === 1) {
						insurePoolDetail.isInsured = 1
					}
					// 不同的步骤，右侧获取的值不一样
					if (isPre) {
						// 获取值为afterChip,展示玩家剩余筹码数量
						// 获取值为leijiPotAmount 展示玩家每一次操作后，对应的底池数量
						bottomRow.afterChip = item?.afterChip
						bottomRow.leijiPotAmount = item.leijiPotAmount
					}
					if (isFlop || isTurn || isRiver) {
						bottomRow.afterChip = item?.afterChip
						bottomRow.leijiPotAmount = item.leijiPotAmount
						bottomRow.isFTR = true
					}
					if (isShowDown) {
						// ShowDown 获取值为netAmount,展示输赢筹码
						bottomRow.resultInfo = item.betAction === "F" ? "Fold" : item.resultInfo // 牌型

						// 只有showDown步骤才会展示手牌和公共牌
						const publicCardsArr = item.publicCards ? item.publicCards.split(",") : []
						const handCardsArr = item.handCards ? item.handCards.split(",") : []

						// 获取置灰的图片
						const grayCardsImgObj = getGrayCardImg(item.showCards, publicCardsArr, handCardsArr)
						bottomRow.publicCardsImg = grayCardsImgObj.publicCardsImg
						bottomRow.handCardsImg = grayCardsImgObj.handCardsImg

						if (item.winSquid === 1) {
							winSquidRoundList.push({
								isWinSquidRecord: true,
								seatCodeName: item.seatCodeName, // 玩家位置
								nickName: item.nickName, // 昵称
								betOpImg: getOtherImg("squid_red"),
								betAmountText: "x" + item.squidNumber // 鱿鱼数量
							})
						}
					}

					bottomRow.isShowFold = false
					bottomRow.showFoldTitle = ""
					if (!bottomRow.hidden) {
						bottomList.push(bottomRow)
					}
				}
			)

			const step = {
				topInfo: topInfo,
				bottomList: bottomList,
				insurePoolDetail: insurePoolDetail
			}
			replayStepArr.push(step)

			// 如果是showdown层下的用户获取鱿鱼记录则添加
			if (winSquidRoundList.length) {
				replayStepArr.push({
					topInfo: {
						stepName: "鱿鱼",
						stepShowIndex: "squidRecord",
						stepItemMiddle: true,
						//
						isShowJoinCount: false,
						isShowPublicCards: false,
						joinCount: undefined,
						potAmount: undefined,
						publicCardsImg: []
					},
					bottomList: winSquidRoundList
				})
			}
		}
	)
	return replayStepArr
}
